package com.motorhome.h5.dao.impl;

import com.motorhome.base.dao.impl.BaseDaoImpl;
import com.motorhome.h5.dao.CommonDao;
import com.motorhome.h5.domain.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Repository;

/**
 * @author: John
 */
@Repository
public class CommonDaoImpl extends BaseDaoImpl implements CommonDao {

    @Override
    public User getUserByPhone(String phone) {
        return queryForObject("select id,phone,user_name,login_pass,create_time,card_id,open_id from uc_user where phone = ?",
                new BeanPropertyRowMapper<>(User.class), phone);
    }

    @Override
    public User getUserById(Long userId) {
        return queryForObject("select id,phone,user_name,login_pass,create_time,card_id,open_id from uc_user where id = ?",
                new BeanPropertyRowMapper<>(User.class), userId);
    }

}
